<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\adminapi\middleware\AdminAuthTokenMiddleware;
use think\facade\Route;

Route::group('pdf', function () {
    Route::get('index', 'v2.Pdf/index');
});

Route::group('teacher', function () {
    Route::post('upload', 'v2.Teacher/upload');
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
]);

Route::post('common/index', 'v2.Index/index')
    ->middleware([
        \app\http\middleware\AllowOriginMiddleware::class,
        \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    ]);

Route::post('question/uploadFile', 'v2.Question/uploadFile')
    ->middleware([
        \app\http\middleware\AllowOriginMiddleware::class,
        \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    ]);

// 教师管理
Route::group('teacher', function () {
    Route::group(function () {
        Route::post('list', 'v2.Teacher/list')->option(['real_name' => '教师列表']);
        Route::post('info', 'v2.Teacher/info')->option(['real_name' => '教师详情']);
        Route::post('save', 'v2.Teacher/save')->option(['real_name' => '保存教师']);
        Route::post('delete', 'v2.Teacher/delete')->option(['real_name' => '删除教师']);
    })->option(['parent' => 'teacher', 'cate_name' => '教师']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'teacher', 'mark_name' => '教师管理']);

Route::group('company', function () {
    Route::group(function () {
        Route::post('list', 'v2.Company/list')->option(['real_name' => '企业列表']);
        Route::post('info', 'v2.Company/info')->option(['real_name' => '企业详情']);
        Route::post('save', 'v2.Company/save')->option(['real_name' => '保存企业']);
        Route::post('delete', 'v2.Company/delete')->option(['real_name' => '删除企业']);
    })->option(['parent' => 'company', 'cate_name' => '企业']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'company', 'mark_name' => '企业管理']);

Route::group('traintype', function () {
    Route::group(function () {
        Route::post('list', 'v2.TrainType/list')->option(['real_name' => '类型列表']);
        Route::post('info', 'v2.TrainType/info')->option(['real_name' => '类型详情']);
        Route::post('save', 'v2.TrainType/save')->option(['real_name' => '保存类型']);
        Route::post('delete', 'v2.TrainType/delete')->option(['real_name' => '删除类型']);
    })->option(['parent' => 'traintype', 'cate_name' => '类型']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'traintype', 'mark_name' => '类型管理']);

Route::group('question', function () {
    Route::group(function () {
        Route::post('list', 'v2.Question/list')->option(['real_name' => '题库列表']);
        Route::post('info', 'v2.Question/info')->option(['real_name' => '题库详情']);
        Route::post('save', 'v2.Question/save')->option(['real_name' => '保存题库']);
        Route::post('delete', 'v2.Question/delete')->option(['real_name' => '删除题库']);
    })->option(['parent' => 'question', 'cate_name' => '题库']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'question', 'mark_name' => '题库管理']);

Route::group('courseware', function () {
    Route::group(function () {
        Route::post('list', 'v2.Courseware/list')->option(['real_name' => '课件列表']);
        Route::post('questionlist', 'v2.Courseware/questionList')->option(['real_name' => '课件选择习题']);
        Route::post('questionall', 'v2.Courseware/questionAll')->option(['real_name' => '平台习题']);
        Route::post('info', 'v2.Courseware/info')->option(['real_name' => '课件详情']);
        Route::post('save', 'v2.Courseware/save')->option(['real_name' => '保存课件']);
        Route::post('delete', 'v2.Courseware/delete')->option(['real_name' => '删除课件']);
    })->option(['parent' => 'courseware', 'cate_name' => '课件']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'courseware', 'mark_name' => '课件管理']);

Route::group('course', function () {
    Route::group(function () {
        Route::post('list', 'v2.Course/list')->option(['real_name' => '课程列表']);
        Route::post('info', 'v2.Course/info')->option(['real_name' => '课程详情']);
        Route::post('save', 'v2.Course/save')->option(['real_name' => '保存课程']);
        Route::post('delete', 'v2.Course/delete')->option(['real_name' => '删除课程']);
        Route::post('warelist', 'v2.Course/courseList')->option(['real_name' => '课件列表']);
    })->option(['parent' => 'course', 'cate_name' => '课程']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'course', 'mark_name' => '课程管理']);

Route::group('test', function () {
    Route::group(function () {
        Route::post('list', 'v2.Test/list')->option(['real_name' => '试卷列表']);
        Route::post('info', 'v2.Test/info')->option(['real_name' => '试卷详情']);
        Route::post('save', 'v2.Test/save')->option(['real_name' => '保存试卷']);
        Route::post('savetopic', 'v2.Test/savetopic')->option(['real_name' => '保存试题']);
        Route::post('randomtopic', 'v2.Test/randomtopic')->option(['real_name' => '随机试题']);
        Route::post('questionlist', 'v2.Test/questionList')->option(['real_name' => '选择试题']);
        Route::post('delete', 'v2.Test/delete')->option(['real_name' => '删除试卷']);
    })->option(['parent' => 'test', 'cate_name' => '试卷']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'test', 'mark_name' => '试卷管理']);

Route::group('systemtype', function () {
    Route::group(function () {
        Route::post('list', 'v2.Systemtype/list')->option(['real_name' => '类型列表']);
        Route::post('info', 'v2.Systemtype/info')->option(['real_name' => '类型详情']);
        Route::post('save', 'v2.Systemtype/save')->option(['real_name' => '保存类型']);
        Route::post('delete', 'v2.Systemtype/delete')->option(['real_name' => '删除类型']);
    })->option(['parent' => 'systemtype', 'cate_name' => '类型']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'systemtype', 'mark_name' => '类型管理']);

Route::group('article', function () {
    Route::group(function () {
        Route::post('index/list', 'v2.article.Article/list')->option(['real_name' => '文章列表']);
        Route::post('index/info', 'v2.article.Article/info')->option(['real_name' => '文章详情']);
        Route::post('index/save', 'v2.article.Article/save')->option(['real_name' => '保存文章']);
        Route::post('index/delete', 'v2.article.Article/delete')->option(['real_name' => '删除文章']);

        Route::post('cate/list', 'v2.article.Type/list')->option(['real_name' => '分类列表']);
        Route::post('cate/info', 'v2.article.Type/info')->option(['real_name' => '分类详情']);
        Route::post('cate/save', 'v2.article.Type/save')->option(['real_name' => '保存分类']);
        Route::post('cate/delete', 'v2.article.Type/delete')->option(['real_name' => '删除分类']);
    })->option(['parent' => 'article', 'cate_name' => '文章']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'article', 'mark_name' => '文章管理']);

// 培训
Route::group('plan', function () {
    Route::post('index/info', 'v2.Plan/info')->option(['real_name' => '培训资料']);
    Route::post('index/list', 'v2.Plan/list')->option(['real_name' => '培训列表']);
    Route::post('course/list', 'v2.Plan/courseList')->option(['real_name' => '课程列表']);
    Route::post('staff/list', 'v2.Plan/staffList')->option(['real_name' => '人员列表']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class,
])->option(['mark' => 'plan', 'mark_name' => '培训管理']);

// 参数管理
Route::group('param', function () {
    Route::post('info', 'v2.Params/info')->option(['real_name' => '参数详情']);
    Route::post('list', 'v2.Params/list')->option(['real_name' => '参数列表']);
    Route::post('save', 'v2.Params/save')->option(['real_name' => '参数保存']);
    Route::post('delete', 'v2.Params/delete')->option(['real_name' => '参数删除']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class,
])->option(['mark' => 'params', 'mark_name' => '参数管理']);

// 子管理员
Route::group('admin', function () {
    Route::post('info', 'v2.Admin/info')->option(['real_name' => '子管理员详情']);
    Route::post('list', 'v2.Admin/list')->option(['real_name' => '子管理员列表']);
    Route::post('save', 'v2.Admin/save')->option(['real_name' => '子管理员保存']);
    Route::post('delete', 'v2.Admin/delete')->option(['real_name' => '子管理员删除']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class,
])->option(['mark' => 'admin', 'mark_name' => '子管理员管理']);
